Skip to content

Add ability to do nested dropdowns in navbar #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 10, 2025
Merged

Add ability to do nested dropdowns in navbar #291

merged 16 commits into from
Jul 10, 2025

Conversation

alasdairwilson
Copy link
Member

@alasdairwilson alasdairwilson commented Jun 24, 2025

sunpy_nav_concertina3

and on narrow devices:

sunpy_nav_concertina_sidebar

This could go upstream I guess but would need to be generalised a fair bit I expect.

Copy link
Member

@Cadair Cadair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR! I have one major issue, but a couple of associated nerd snipes.

My main issue is the changing of the hover-over styling:

before:
image

after:
image

My other requests are:

  1. How would we feel about this being a concertina style thing where we have subsections of the menu expanding rather than popping out to the right?
  2. Is there any chance you can make this code handle the case where the menu goes off the bottom of the display? (i.e. by collapsing the main list?)

@alasdairwilson
Copy link
Member Author

Thanks a lot for the PR! I have one major issue, but a couple of associated nerd snipes.

My main issue is the changing of the hover-over styling:

  1. How would we feel about this being a concertina style thing where we have subsections of the menu expanding rather than popping out to the right?
  2. Is there any chance you can make this code handle the case where the menu goes off the bottom of the display? (i.e. by collapsing the main list?)

So this second iteration now uses concertina collapse rather than a dropdown, I think it is more suitable. It is still recursive though so you can have arbitrary depth on the nav sections.

Importantly, hover over styling is fixed, I thought it was just lazy css originally but turns out its a pain cause we are having to replace loads of built in bootstrap stuff cause it doesnt support either nested dropdowns (as my first iteration did) or concertinas in dropdowns (as my second one does).

as for going off the screeen errr.... one sec

@alasdairwilson
Copy link
Member Author

alasdairwilson commented Jul 10, 2025

scrollable_dropdown

for quibble 2:

I have made it scrollable, which I think is important for accessibility (even though the sidebar is already scrollable).

I don't think it needs anything fancier than that.

@alasdairwilson alasdairwilson requested a review from Cadair July 10, 2025 11:01
@Cadair

This comment was marked as outdated.

@Cadair
Copy link
Member

Cadair commented Jul 10, 2025

The CSS seems to be busted on all the preview builds?

@alasdairwilson
Copy link
Member Author

as an aside, I fixed the position the dropdown appears in the first place:
image
cause I cant imagine it was intended that it covered the top bar.

("ndcube", "https://docs.sunpy.org/projects/ndcube/", 3),
("aiapy", "https://aiapy.readthedocs.io/", 3),
("dkist", "https://docs.dkist.nso.edu/projects/python-tools", 3),
("demcmc", "https://demcmc.readthedocs.io/en/stable/", 3),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably submit this to be an affiliated package before we add it here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to historical, it used to be a AF.

@nabobalis
Copy link
Member

Thank you @alasdairwilson

@nabobalis nabobalis merged commit 690a4c2 into main Jul 10, 2025
10 checks passed
@nabobalis nabobalis deleted the add-submenu-js branch July 10, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants